<template>
    <div class="slider">
      <el-menu
        default-active="2"
        unique-opened
        class="el-menu-vertical-demo"
        background-color="#002c5d"
        text-color="#A6CEF4"
        router
        @open="handleOpen"
        @close="handleClose">
        <el-submenu v-for="(item, index) in menuList" :index="item.index" :key="index">
          <template slot="title">
            <i class="el-icon-odometer"></i>
            <span>{{item.node}}</span>
          </template>
          <el-menu-item-group v-for="(sun, index) in item.children" :key="index">
            <el-menu-item class="menu-item-left" :index="sun.router">{{sun.node}}</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </div>
</template>

<script>
  export default {
    name: 'slider',
    data() {
      return {
        menuList: [
          {
            node: '总览',
            router: '',
            index: '',
            icon: '',
            children: [
              {
                icon: '',
                node: '子级菜单1',
                router: ''
              },
              {
                node: '子级菜单1',
                router: ''
              },
            ]
          },
          {
            node: '总览',
            router: '',
            index: '',
            children: [],
          },
          {
            node: '总览',
            router: '',
            index: '',
            children: [
              {
                node: '子级菜单1',
                router: ''
              }
            ]
          },
          {
            node: '总览',
            router: '',
            index: '',
            children: []
          }
        ]
      }
    },
    methods: {
      handleOpen() {},
      handleClose() {}
    }
  }
</script>

<style lang="scss" scoped>
  .slider{
    height: 100%;
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    box-sizing: content-box;
    .el-menu{
      width: 240px;
      flex: 1;
    }

    .el-menu-item.is-active {
      background-color: #031d42 !important;
    }
    .el-menu-item{
      min-width: 239px !important;
      text-align: left;
    }
    .menu-item-left{
      padding-left: 48px !important;
    }
    .el-submenu{
      text-align: left;
    }

  }
</style>
